package cn.tedu.spring.begin;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;

public class UserTest {
    public static void main(String[] args) throws Exception{
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        User user = (User) context.getBean("user");
        System.out.println("user=" + user);
        user.add();

        User user1 = new User();
        System.out.println("user1"+user1);
        user1.add();

        Class zz = Class.forName("cn.tedu.spring.begin.User");
        User user2 = (User) zz.newInstance();
        System.out.println("user2="+user2);
        user2.add();
    }
}
